/* GUI CONVERTED from eciq14.p (converter v1.75) Mon Aug 14 12:26:57 2000 */
/* eciq14.p - ECN APPROVALS AND TRAILER                                 */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/*F0PN*/ /*V8:ConvertMode=Report                                        */
/*K1Q4*/ /*V8:RunMode=Character,Windows                                 */
/* REVISION: 7.4      LAST MODIFIED: 04/21/94   BY: qzl *H358*          */
/*                                   04/24/95   by: srk *H0C4*          */
/* REVISION: 8.5      LAST MODIFIED: 11/29/96   BY: *J16W*  Russ Witt        */
/* REVISION: 8.6      LAST MODIFIED: 12/06/96   by: Joe Gawel *K00C*     */
/* REVISION: 8.6      LAST MODIFIED: 05/20/98   by: *K1Q4* Alfred Tan        */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/14/00 BY: *N0KW* Jacolyn Neder       */

/*K00C* Change all references to ecd9_det to rsu_mstr and rsud_det
 *      Change all references to eca_mstr to rst_mstr and rstd_det
 *      Change all references to ect_mstr to pct_mstr
 *K00C*/


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

   {mfdeclre.i}
{gplabel.i} /* EXTERNAL LABEL INCLUDE */

/*H0C4*  {ecmtparm.i} */
/*H0C4*/ /*PLACED CONTENTS OF ECMTPARM.I IN HERE*/
         define input parameter ecm_recid as recid.
         define input parameter prog_type as character.
         define input parameter inq_yn as logical.
         define input parameter dmpld like mfc_logical.
         define input parameter mstrfile like mfc_logical.
         define input parameter repro like mfc_logical.
         define output parameter msgnbr like msg_nbr initial 0.
         define output parameter warnlvl as integer initial 0.

         define variable ecd1par like ecd1_par no-undo.
         define variable ecd1comp like ecd1_comp no-undo.
         define variable ecd1ref  like ecd1_ref no-undo.
         define variable ecd9qad03 like eca_reroute.
         define variable reroute   like mfc_logical.
         define new shared variable apprgroup like eca_group.
/*J16W*  define variable cmmt like mfc_logical initial no label "Comments". */
         define variable closed_yn like mfc_logical.
         define variable ecmnbrto like ecm_nbr_to.
         define shared variable yn like mfc_logical.
         define variable true1 like mfc_logical initial yes.
         define variable false1 like mfc_logical initial no.

         define shared workfile ecmmstr like ecm_mstr.
/*K00C** define shared workfile ecd9det like ecd9_det. */
/*K00C*/ define shared temp-table rsumstr like rsu_mstr.
/*K00C*/ define shared temp-table rsuddet like rsud_det.
         define shared variable error_msg as character format "x(60)" extent 10.

/*K00C** do for ecmmstr,ecd9det: */
/*K00C*/ do for ecmmstr,rsumstr,rsuddet:

         /* DISPLAY SELECTION FORM */
         FORM /*GUI*/ 
/*J16W*     {ecform08.i}  */
/*J16W*/    {ecform14.i}
         with STREAM-IO /*GUI*/  frame form08 width 80 attr-space down.

         /* SET EXTERNAL LABELS */
         setFrameLabels(frame form08:handle).

         FORM /*GUI*/ 
            {ecform07.i}
         with STREAM-IO /*GUI*/  frame form07 attr-space side-labels width 80.

         /* SET EXTERNAL LABELS */
         setFrameLabels(frame form07:handle).

         find first ecmmstr where recid(ecmmstr) = ecm_recid no-lock no-error.
         if not available (ecmmstr) then return.

/*K00C*  find first ecd9det where ecd9_nbr = ecm_nbr no-error.
 *   if available ecd9det then page.
 *K00C*/ find first rsumstr where rsu_doc_nbr = ecm_nbr no-error.
/*K00C*/ if available rsumstr then page.

/*K00C** for each ecd9det no-lock where ecd9_nbr = ecm_nbr
 *   by ecd9_seq with frame form08:
 *       display  ecd9_group @ apprgroup
 *          ecd9_seq
 *          integer(ecd9__qad03) @ ecd9qad03
 *          true1 when ecd9__qad04 = "R" @ reroute
 *          false1 when ecd9__qad04 <> "R" @ reroute
 *          ecd9_approved ecd9__qad05 ecd9_appr_date
 * /*J16W*            "" @ cmmt   */
 *       with frame form08.
 *K00C** added code below**/
         for each rsumstr no-lock where rsu_doc_nbr = ecm_nbr,
         each rsuddet no-lock where rsuddet.rsud_index = rsumstr.rsu_index
   by rsud_sequence with frame form08:
       display rsud_group @ apprgroup
          rsud_sequence
          rsud_svrty_lvl @ ecd9qad03
          true1 when (rsud_canreroute) @ reroute
          false1 when (not rsud_canreroute) @ reroute
          rsud_approved rsud_approverid rsud_appr_date
       with frame form08 STREAM-IO /*GUI*/ .
/*K00C*** end added code **/

             if not dmpld then do:
             if not mstrfile then put error_msg[6].

/*K00C**     else if can-find(ecd9_det where ecd9_det.ecd9_nbr =
 *       ecd9det.ecd9_nbr and ecd9_det.ecd9_group =
 *       ecd9det.ecd9_group) then put error_msg[1].
 *K00C*/     else do:
/*K00C*/        find first rsu_mstr where rsu_doc_nbr = rsumstr.rsu_doc_nbr
/*K00C*/        no-lock no-error.
/*K00C*/        if available rsu_mstr and can-find(rsud_det where
/*K00C*/        rsud_det.rsud_index = rsu_mstr.rsu_index and
/*K00C*/        rsud_det.rsud_group = rsuddet.rsud_group) then
/*K00C*/        put error_msg[1].

/*K00C**       else if not dmpld and not repro and not can-find(first ecl_list*/
/*K00C*/       else if not dmpld and not repro and not can-find(first pcl_mstr
/*K00C**       where ecl_group  = ecd9det.ecd9_group and ecl_type = "20") */
/*K00C*/       where pcl_group  = rsuddet.rsud_group)
               then put error_msg[4].

               else if not dmpld and not repro then do:
/*K00C*          find ect_mstr where ect_type = ecmmstr.ecm_type and */
/*K00C*          ect_dsgn_grp = ecmmstr.ecm_assign no-lock no-error. */
/*K00C*          if not can-find(eca_mstr where eca_code = ect_approval and */
/*K00C*          eca_group = ecd9det.ecd9_group) then put error_msg[5].*/
/*K00C*/   find pct_mstr where pct_type = ecmmstr.ecm_type and
/*K00C*/   pct_dsgn_grp = ecmmstr.ecm_assign no-lock no-error.
/*K00C*/   if not can-find(rstd_det where rstd_appr_code = pct_approval
/*K00C*/   and rstd_group = rsuddet.rsud_group) then put error_msg[5].
               end.
/*K00C*/     end.
           end.

             down.
             
/*GUI*/ {mfguichk.i  &warn=false} /*Replace mfrpchk*/

         end.

         
/*GUI*/ {mfguichk.i  &warn=false} /*Replace mfrpchk*/

         yn = yes.
         end. /* end of do for */
